package com.charles.spring.ch2.scope;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * Created by charles on 2017/4/28.
 */
public class Main {
    public static void main(String[] args) {
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ScopeConfig.class);

        DemoSingletonService singleton1 = context.getBean(DemoSingletonService.class);
        DemoSingletonService singleton2 = context.getBean(DemoSingletonService.class);

        DemoPrototypeService prototype1 = context.getBean(DemoPrototypeService.class);
        DemoPrototypeService prototype2 = context.getBean(DemoPrototypeService.class);

        System.out.println("singleton1 与 singleton2 是否相等: " + singleton1.equals(singleton2));
        System.out.println("prototype1 与 prototype1 是否相等: " + prototype1.equals(prototype2));
    }
}
